package com.avcdata.aoscustommade.utils;

import android.util.Log;

import com.github.mikephil.charting.components.AxisBase;
import com.github.mikephil.charting.formatter.IAxisValueFormatter;

import java.text.DecimalFormat;
import java.util.ArrayList;

public class MyXValueFormatter implements IAxisValueFormatter {

    private ArrayList<String> weekData;
    private DecimalFormat mFormat;

    public MyXValueFormatter(ArrayList<String> weekData) {
        this.weekData = weekData;
//        Log.e("click","--------设置星期数坐标--------"+weekData.size());
        mFormat = new DecimalFormat("0");

    }

    @Override
    public String getFormattedValue(float value, AxisBase axis) {
//        Log.e("string","--------设置城市页用星期数坐标--------= "+(value-1) % weekData.size());
        if (weekData.size() < 8 ){
            if (value < 1|| value == weekData.size()+1){
                return "";
            }
            return weekData.get(Integer.valueOf(mFormat.format(value-1))% weekData.size());

        }else {
//            if (value<0||value==weekData.size()){
//                return "";
//            }
            if (value==weekData.size()){
                return "";
            }
            return weekData.get(Integer.valueOf(mFormat.format(value))% weekData.size());

        }

    }


    
}
